package com.zyy;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
/**
 * @ProjectName: concurrent
 * @Package: com.zyy
 * @ClassName: EndThread
 * @Author: ZHAYUYAO
 * @Description: 初步了解线程
 * @Date: 2019/9/4 22:31
 * @Version: 1.0
 */
public class Main {

    public static void main(String[] args) {
        //虚拟机线程管理的接口
        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
        ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(false,false);
        for (ThreadInfo threadInfo : threadInfos) {
            System.out.println("["+threadInfo.getThreadId()+"]"+threadInfo.getThreadName());
        }
    }
}
